﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.Medias;

namespace PMS.Data.EntityMap.Medias
{
    /// <summary>
    /// Represents a MimeType mapping configuration
    /// </summary>
    public partial class MimeTypesMap : PMSEntityTypeConfiguration<MimeTypes>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<MimeTypes> builder)
        {
            builder.ToTable("bus_mimetypes");
            builder.HasKey(mime => mime.Id);

            builder.Property(mime => mime.ExtensionName).HasMaxLength(32).IsRequired();
            builder.Property(mime => mime.MimeType).HasMaxLength(64).IsRequired();
            builder.Property(mime => mime.Category).HasMaxLength(32).IsRequired();
            builder.Property(mime => mime.OutputExtensionName).HasMaxLength(32).IsRequired();
            builder.Property(mime => mime.Description).HasMaxLength(64);
            builder.Property(mime => mime.IsActive).IsRequired();
            builder.Ignore(mime => mime.CreatedOnTimeUtc);
            builder.Ignore(mime => mime.UpdatedOnTimeUtc);
            base.Configure(builder);
        }

        #endregion
    }
}
